Does anyone know how can I get the attribute of an object in this example?
DB objAttr
DBE lstAttr
string arrLst[] = {}
Object obj = current
string Absno = identifier(obj)
void getAttrList ()
{
AttrDef ad
Module m = current
Skip attrList = createString()
string attrName
for ad in m do
{
if ((!null ad) || (!ad.system))
{
attrName = ad.name
put(attrList, attrName, attrName)
}
}
for attrName in attrList do
{
insert(lstAttr, noElems(lstAttr), (string key attrList), iconNone)
}
insertColumn(lstAttr, 0, "Attributes List", 175, iconNone)
delete(attrList)
}
void getAttrList2 ()
{
AttrDef ad
Module m = current
Skip objData = createString()
string attrName, attrDesc
int i = 0
for ad in m do
{
if ((!null ad) || (!ad.system))
{
attrName = ad.name
attrDesc = obj.attrName""// How to get the attribute data based on the attribute name above declare?
put(objData, attrDesc, attrDesc)
}
}
for attrDesc in objData do
{
insert(lstAttr, noElems(lstAttr), (string key objData), iconNone)
}
insertColumn(lstAttr, 1, "Attributes List", 300, iconNone)
delete(objData)
}
objAttr = create(Absno" Attributes", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
realize(objAttr)
getAttrList()
getAttrList2()
show(objAttr)
SystemAdmin - Mon Sep 21 09:49:12 EDT 2009 |
Re: How to get the attribute data looping thru attributes?
I found the way, but I don't know why I can not insert them in a different column. Any hint will be appreciated.
DB objAttr
DBE lstAttr
string arrLst[] = {}
Object obj = current
string Absno = identifier(obj)
void getAttrList (DBE Elem)
{
AttrDef ad
Module m = current
Skip attrList = createString()
string attrName
for ad in m do
{
if ((!null ad) || (!ad.system))
{
attrName = ad.name
put(attrList, attrName, attrName)
}
}
for attrName in attrList do
{
insert(lstAttr, noElems(lstAttr), (string key attrList), iconNone)
}
insertColumn(lstAttr, 0, "Attributes", 175, iconNone)
delete(attrList)
}
void getAttrList2 (DBE Elem)
{
AttrDef ad
Module m = current
Skip objData = createString()
string attrName, attrDesc
int i = 0
for ad in m do
{
if ((!null ad) && (!ad.system))
{
attrName = ad.name
obj = current
attrDesc = (obj).(attrName)
if(!null attrDesc)
{
put(objData, attrDesc, attrDesc)
}
else
{
attrDesc = "No Val"
put(objData, attrDesc, attrDesc)
}
}
}
for attrDesc in objData do
{
insert(lstAttr, noElems(lstAttr), (string key objData), iconNone)
}
insertColumn(lstAttr, 1, "Values", 300, iconNone)
delete(objData)
}
objAttr = create("["Absno"] Object Attributes", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
realize(objAttr)
getAttrList(lstAttr)
getAttrList2(lstAttr)
show(objAttr)
|
Re: How to get the attribute data looping thru attributes? SystemAdmin - Mon Sep 21 10:30:53 EDT 2009
I found the way, but I don't know why I can not insert them in a different column. Any hint will be appreciated.
DB objAttr
DBE lstAttr
string arrLst[] = {}
Object obj = current
string Absno = identifier(obj)
void getAttrList (DBE Elem)
{
AttrDef ad
Module m = current
Skip attrList = createString()
string attrName
for ad in m do
{
if ((!null ad) || (!ad.system))
{
attrName = ad.name
put(attrList, attrName, attrName)
}
}
for attrName in attrList do
{
insert(lstAttr, noElems(lstAttr), (string key attrList), iconNone)
}
insertColumn(lstAttr, 0, "Attributes", 175, iconNone)
delete(attrList)
}
void getAttrList2 (DBE Elem)
{
AttrDef ad
Module m = current
Skip objData = createString()
string attrName, attrDesc
int i = 0
for ad in m do
{
if ((!null ad) && (!ad.system))
{
attrName = ad.name
obj = current
attrDesc = (obj).(attrName)
if(!null attrDesc)
{
put(objData, attrDesc, attrDesc)
}
else
{
attrDesc = "No Val"
put(objData, attrDesc, attrDesc)
}
}
}
for attrDesc in objData do
{
insert(lstAttr, noElems(lstAttr), (string key objData), iconNone)
}
insertColumn(lstAttr, 1, "Values", 300, iconNone)
delete(objData)
}
objAttr = create("["Absno"] Object Attributes", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
realize(objAttr)
getAttrList(lstAttr)
getAttrList2(lstAttr)
show(objAttr)
|
Re: How to get the attribute data looping thru attributes? llandale - Mon Sep 21 14:00:45 EDT 2009
Louie,
DB objAttr
DBE lstAttr
string arrLst[] = {}
Object obj = current
string Absno = identifier(obj)
void getAttrList (DBE Elem)
{
AttrDef ad
Module m = current
Skip attrList = createString()
Skip objData = createString()
string attrName, attrData, attr
int i = 0
for ad in m do
{
if ((ad.object))
{
attrName = ad.name
put(attrList, attrName, attrName)
attrData = obj.attrName ""
put(objData, attrData, attrData)
}
}
for attrName in attrList do
{
insert(lstAttr, noElems(lstAttr), (string key attrList), iconNone)
}
for attrData in objData do
{
insert(lstAttr, noElems(lstAttr), (string key objData ), iconNone)
}
insertColumn(lstAttr, 0, "Attributes", 175, iconNone)
insertColumn(lstAttr, 1, "Values", 300, iconNone)
delete(attrList)
}
objAttr = create("["Absno"] Object Attributes", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
realize(objAttr)
getAttrList(lstAttr)
show(objAttr)
|
Re: How to get the attribute data looping thru attributes? SystemAdmin - Mon Sep 21 14:14:38 EDT 2009
Louie,
DB objAttr
DBE lstAttr
string arrLst[] = {}
Object obj = current
string Absno = identifier(obj)
void getAttrList (DBE Elem)
{
AttrDef ad
Module m = current
Skip attrList = createString()
Skip objData = createString()
string attrName, attrData, attr
int i = 0
for ad in m do
{
if ((ad.object))
{
attrName = ad.name
put(attrList, attrName, attrName)
attrData = obj.attrName ""
put(objData, attrData, attrData)
}
}
for attrName in attrList do
{
insert(lstAttr, noElems(lstAttr), (string key attrList), iconNone)
}
for attrData in objData do
{
insert(lstAttr, noElems(lstAttr), (string key objData ), iconNone)
}
insertColumn(lstAttr, 0, "Attributes", 175, iconNone)
insertColumn(lstAttr, 1, "Values", 300, iconNone)
delete(attrList)
}
objAttr = create("["Absno"] Object Attributes", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
realize(objAttr)
getAttrList(lstAttr)
show(objAttr)
I think you are a bit confused on the use of skip lists and how to populate listview columns. Hope this helps a little.
DB objAttr
DBE lstAttr
string arrLst[] = {}
Object obj = current
string Absno = identifier(obj)
// attrList is a Skip list where:
// KEY= Attribute Name
// Data = Attribute Value
void getAttrList (DBE Elem)
{
AttrDef ad
Module m = current
Skip attrList = createString()
string attrName, attrData, attr
int i = 0
for ad in m do
{
if ((ad.object))
{
attrName = ad.name
put(attrList, attrName, obj.attrName "")
}
}
int irow = 0
for attrData in attrList do
{
insert(lstAttr, irow, (string key attrList), iconNone)
set(lstAttr, irow++,1, attrData )
}
delete(attrList)
}
objAttr = create("["Absno"] Object Attributes", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
realize(objAttr)
insertColumn(lstAttr, 0, "Attributes", 175, iconNone)
insertColumn(lstAttr, 1, "Values", 300, iconNone)
getAttrList(lstAttr)
show(objAttr)
|
Re: How to get the attribute data looping thru attributes? Doug.Zawacki - Mon Sep 21 16:13:06 EDT 2009 I think you are a bit confused on the use of skip lists and how to populate listview columns. Hope this helps a little.
DB objAttr
DBE lstAttr
string arrLst[] = {}
Object obj = current
string Absno = identifier(obj)
// attrList is a Skip list where:
// KEY= Attribute Name
// Data = Attribute Value
void getAttrList (DBE Elem)
{
AttrDef ad
Module m = current
Skip attrList = createString()
string attrName, attrData, attr
int i = 0
for ad in m do
{
if ((ad.object))
{
attrName = ad.name
put(attrList, attrName, obj.attrName "")
}
}
int irow = 0
for attrData in attrList do
{
insert(lstAttr, irow, (string key attrList), iconNone)
set(lstAttr, irow++,1, attrData )
}
delete(attrList)
}
objAttr = create("["Absno"] Object Attributes", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
realize(objAttr)
insertColumn(lstAttr, 0, "Attributes", 175, iconNone)
insertColumn(lstAttr, 1, "Values", 300, iconNone)
getAttrList(lstAttr)
show(objAttr)
Yes the Skip lists are odd; and the way it was coded will not correctly pair up an attr with its data since retrieval from the skip is done in Key alpha order. Your solution puts the attr name as the Skip's 'key' and retrieved attr value as the 'data'; that's routine use of a Skip. And I notice that since the 'key' is type 'string', you use 'createString' instead of 'create'.
//**********************
void RemoveSyncTrigger(Trigger trg)
{ if (!null trg) delete(trg)
} // end RemoveTrigger()
//***********************
void clbkSyncObj(Trigger trg)
{ // React when user selects a new object
if (null dbArch or !showing(dbArch))
{ // Dialog no longer showing. Delete the trigger
RemoveSyncTrigger(trg)
}
// Now update the Dialog with values...
Object oTrg = object(trg)
Object oCurr = current(g_mCurr)
if (null oTrg)
{ print ">>clbkSyncObj, null object of Trigger.\n"
}
elseif (oTrg != oCurr)
{ print ">>clbkSyncObj, Trigger obj != Current: #" identifier(oTrg) " #" identifier(oCurr) "\n"
}
else
{ DisplayCurrentObject(oTrg) // The bulk of your code, after the realize, goes into this function.
}
} // end clbkSyncObj()
//***********************
void DeploySyncTrigger()
{
g_trgSync = trigger(object, sync, 8, clbkSyncObj)
} // end DeploySyncTrigger()
//**********************
void applyClose(DB dbXX)
{ // Close the Dialog
hide(dbArch)
destroy(dbArch)
RemoveSyncTrigger()
} // end applyClose()
Your make dialog has this code:
close(dbArch, true, applyClose) // Define custom Close for this dialog
DeploySyncTrigger()
|
Re: How to get the attribute data looping thru attributes? llandale - Mon Sep 21 18:25:34 EDT 2009
Yes the Skip lists are odd; and the way it was coded will not correctly pair up an attr with its data since retrieval from the skip is done in Key alpha order. Your solution puts the attr name as the Skip's 'key' and retrieved attr value as the 'data'; that's routine use of a Skip. And I notice that since the 'key' is type 'string', you use 'createString' instead of 'create'.
//**********************
void RemoveSyncTrigger(Trigger trg)
{ if (!null trg) delete(trg)
} // end RemoveTrigger()
//***********************
void clbkSyncObj(Trigger trg)
{ // React when user selects a new object
if (null dbArch or !showing(dbArch))
{ // Dialog no longer showing. Delete the trigger
RemoveSyncTrigger(trg)
}
// Now update the Dialog with values...
Object oTrg = object(trg)
Object oCurr = current(g_mCurr)
if (null oTrg)
{ print ">>clbkSyncObj, null object of Trigger.\n"
}
elseif (oTrg != oCurr)
{ print ">>clbkSyncObj, Trigger obj != Current: #" identifier(oTrg) " #" identifier(oCurr) "\n"
}
else
{ DisplayCurrentObject(oTrg) // The bulk of your code, after the realize, goes into this function.
}
} // end clbkSyncObj()
//***********************
void DeploySyncTrigger()
{
g_trgSync = trigger(object, sync, 8, clbkSyncObj)
} // end DeploySyncTrigger()
//**********************
void applyClose(DB dbXX)
{ // Close the Dialog
hide(dbArch)
destroy(dbArch)
RemoveSyncTrigger()
} // end applyClose()
Your make dialog has this code:
close(dbArch, true, applyClose) // Define custom Close for this dialog
DeploySyncTrigger()
Where or What is the problem now. Runs, but the data is not displayed in the listview and is creating new columns.
DB objAttr
DBE lstAttr
string arrLst[] = {}
Object obj = current
string Absno = identifier(obj)
Module g_mCurr = current
Trigger trg
//**********************
void RemoveSyncTrigger(Trigger trg)
{ if (!null trg) delete(trg)
} // end RemoveTrigger()
//***********************
void clbkSyncObj(Trigger trg)
{ // React when user selects a new object
if ((null objAttr) || (!showing(objAttr)))
{ // Dialog no longer showing. Delete the trigger
RemoveSyncTrigger(trg)
}
// Now update the Dialog with values...
Object oTrg = object(trg)
Object oCurr = current(g_mCurr)
if (null oTrg)
{ print ">>clbkSyncObj, null object of Trigger.\n"
}
elseif (oTrg != oCurr)
{ print ">>clbkSyncObj, Trigger obj != Current: #" identifier(oTrg) " #" identifier(oCurr) "\n"
}
else
{
void getAttrList(DBE Elem) {
AttrDef ad
Module m = current
Skip attrList = createString()
string attrName, attrData, attr
int i = 0
for ad in m do
{
if ((ad.object))
{
attrName = ad.name
put(attrList, attrName, obj.attrName "")
}
}
int irow = 0
for attrData in attrList do
{
insert(lstAttr, irow, (string key attrList), iconNone)
set(lstAttr, irow++,1, attrData )
}
insertColumn(lstAttr, 0, "Attributes", 175, iconNone)
insertColumn(lstAttr, 1, "Values", 300, iconNone)
delete(attrList)
}
//DisplayCurrentObject(oTrg) // The bulk of your code, after the realize, goes into this function.
}
} // end clbkSyncObj()
//***********************
void DeploySyncTrigger()
{
g_trgSync = trigger(object, sync, 8, clbkSyncObj)
} // end DeploySyncTrigger()
//**********************
void applyClose(DB dbXX)
{ // Close the Dialog
hide(objAttr)
destroy(objAttr)
RemoveSyncTrigger(trg)
} // end applyClose()
objAttr = create(" Object Attributes", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
close(objAttr, true, applyClose) // Define custom Close for this dialog
realize(objAttr)
DeploySyncTrigger()
show(objAttr)
|
Re: How to get the attribute data looping thru attributes? llandale - Mon Sep 21 18:25:34 EDT 2009
Yes the Skip lists are odd; and the way it was coded will not correctly pair up an attr with its data since retrieval from the skip is done in Key alpha order. Your solution puts the attr name as the Skip's 'key' and retrieved attr value as the 'data'; that's routine use of a Skip. And I notice that since the 'key' is type 'string', you use 'createString' instead of 'create'.
//**********************
void RemoveSyncTrigger(Trigger trg)
{ if (!null trg) delete(trg)
} // end RemoveTrigger()
//***********************
void clbkSyncObj(Trigger trg)
{ // React when user selects a new object
if (null dbArch or !showing(dbArch))
{ // Dialog no longer showing. Delete the trigger
RemoveSyncTrigger(trg)
}
// Now update the Dialog with values...
Object oTrg = object(trg)
Object oCurr = current(g_mCurr)
if (null oTrg)
{ print ">>clbkSyncObj, null object of Trigger.\n"
}
elseif (oTrg != oCurr)
{ print ">>clbkSyncObj, Trigger obj != Current: #" identifier(oTrg) " #" identifier(oCurr) "\n"
}
else
{ DisplayCurrentObject(oTrg) // The bulk of your code, after the realize, goes into this function.
}
} // end clbkSyncObj()
//***********************
void DeploySyncTrigger()
{
g_trgSync = trigger(object, sync, 8, clbkSyncObj)
} // end DeploySyncTrigger()
//**********************
void applyClose(DB dbXX)
{ // Close the Dialog
hide(dbArch)
destroy(dbArch)
RemoveSyncTrigger()
} // end applyClose()
Your make dialog has this code:
close(dbArch, true, applyClose) // Define custom Close for this dialog
DeploySyncTrigger()
This is the best code ever for the problem i need to solve for an user, but I can't find where is the problem.
DB objAttr
DBE lstAttr
string arrLst[] = {}
Module mTitle = current
Object obj = current
string Absno = identifier(obj)
Trigger trg
Module m
void getAttrList ()
{
AttrDef ad
m = current
Skip attrList = createString()
string attrName, attrData, attr
Object obj
int i = 0
//Clear Columns
for ad in m do
{
if ((ad.object))
{
attrName = ad.name
obj = current(m)
attrData = obj.attrName""
put(attrList, attrName, attrData)
}
}
for attrData in attrList do
{
insert(lstAttr, i, (string key attrList), iconNone)
set(lstAttr, i++, 1, attrData)
}
delete(attrList)
}
//**********************
void RemoveSyncTrigger(Trigger trg)
{
if (!null trg) delete(trg)
} // end RemoveTrigger()
//***********************
void clbkSyncObj(Trigger trg)
{ // React when user selects a new object
if (null objAttr or !showing(objAttr))
{ // Dialog no longer showing. Delete the trigger
RemoveSyncTrigger(trg)
}
// Now update the Dialog with values...
m = current
Object oTrg = object(trg)
Object oCurr = current(m)
if (null oTrg)
{ print ">>clbkSyncObj, null object of Trigger.\n"
}
elseif (oTrg != oCurr)
{ print ">>clbkSyncObj, Trigger obj != Current: #" identifier(oTrg) " #" identifier(oCurr) "\n"
}
else
{
empty(lstAttr)
realize(objAttr)
getAttrList() // The bulk of your code, after the realize, goes into this function.
}
} // end clbkSyncObj()
//***********************
void DeploySyncTrigger()
{
g_trgSync = trigger(object, sync, 8, clbkSyncObj)
} // end DeploySyncTrigger()
//**********************
void applyClose(DB dbXX)
{ // Close the Dialog
hide(objAttr)
destroy(objAttr)
RemoveSyncTrigger()
} // end applyClose()
objAttr = create("Object Attributes - "name(mTitle)"", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
close(objAttr, true, applyClose) // Define custom Close for this dialog
DeploySyncTrigger()
realize(objAttr)
insertColumn(lstAttr, 0, "Attributes", 175, iconNone)
insertColumn(lstAttr, 1, "Values", 300, iconNone)
getAttrList()
show(objAttr)
|
Re: How to get the attribute data looping thru attributes? SystemAdmin - Wed Sep 23 08:50:17 EDT 2009
This is the best code ever for the problem i need to solve for an user, but I can't find where is the problem.
DB objAttr
DBE lstAttr
string arrLst[] = {}
Module mTitle = current
Object obj = current
string Absno = identifier(obj)
Trigger trg
Module m
void getAttrList ()
{
AttrDef ad
m = current
Skip attrList = createString()
string attrName, attrData, attr
Object obj
int i = 0
//Clear Columns
for ad in m do
{
if ((ad.object))
{
attrName = ad.name
obj = current(m)
attrData = obj.attrName""
put(attrList, attrName, attrData)
}
}
for attrData in attrList do
{
insert(lstAttr, i, (string key attrList), iconNone)
set(lstAttr, i++, 1, attrData)
}
delete(attrList)
}
//**********************
void RemoveSyncTrigger(Trigger trg)
{
if (!null trg) delete(trg)
} // end RemoveTrigger()
//***********************
void clbkSyncObj(Trigger trg)
{ // React when user selects a new object
if (null objAttr or !showing(objAttr))
{ // Dialog no longer showing. Delete the trigger
RemoveSyncTrigger(trg)
}
// Now update the Dialog with values...
m = current
Object oTrg = object(trg)
Object oCurr = current(m)
if (null oTrg)
{ print ">>clbkSyncObj, null object of Trigger.\n"
}
elseif (oTrg != oCurr)
{ print ">>clbkSyncObj, Trigger obj != Current: #" identifier(oTrg) " #" identifier(oCurr) "\n"
}
else
{
empty(lstAttr)
realize(objAttr)
getAttrList() // The bulk of your code, after the realize, goes into this function.
}
} // end clbkSyncObj()
//***********************
void DeploySyncTrigger()
{
g_trgSync = trigger(object, sync, 8, clbkSyncObj)
} // end DeploySyncTrigger()
//**********************
void applyClose(DB dbXX)
{ // Close the Dialog
hide(objAttr)
destroy(objAttr)
RemoveSyncTrigger()
} // end applyClose()
objAttr = create("Object Attributes - "name(mTitle)"", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
close(objAttr, true, applyClose) // Define custom Close for this dialog
DeploySyncTrigger()
realize(objAttr)
insertColumn(lstAttr, 0, "Attributes", 175, iconNone)
insertColumn(lstAttr, 1, "Values", 300, iconNone)
getAttrList()
show(objAttr)
I found one problem related to the trigger. I have now globally declared Trigger g_trgSync, and have modified void RemoveSyncTrigger (it expected a trigger as input variable, but was called in one place without variables; it is now always working on the global trigger variable).
DB objAttr
DBE lstAttr
string arrLst[] = {}
Module mTitle = current
Object obj = current
string Absno = identifier(obj)
Trigger g_trgSync = null
Module m
void getAttrList ()
{
AttrDef ad
m = current
Skip attrList = createString()
string attrName, attrData, attr
Object obj
int i = 0
//Clear Columns
for ad in m do
{
if ((ad.object))
{
attrName = ad.name
obj = current(m)
attrData = obj.attrName""
put(attrList, attrName, attrData)
}
}
for attrData in attrList do
{
insert(lstAttr, i, (string key attrList), iconNone)
set(lstAttr, i++, 1, attrData)
}
delete(attrList)
}
//**********************
void RemoveSyncTrigger()
{
if (!null g_trgSync) delete(g_trgSync)
} // end RemoveTrigger()
//***********************
void clbkSyncObj(Trigger trg)
{ // React when user selects a new object
if (null objAttr or !showing(objAttr))
{ // Dialog no longer showing. Delete the trigger
RemoveSyncTrigger()
}
// Now update the Dialog with values...
m = current
Object oTrg = object(trg)
Object oCurr = current(m)
if (null oTrg)
{ print ">>clbkSyncObj, null object of Trigger.\n"
}
elseif (oTrg != oCurr)
{ print ">>clbkSyncObj, Trigger obj != Current: #" identifier(oTrg) " #" identifier(oCurr) "\n"
}
else
{
empty(lstAttr)
realize(objAttr)
getAttrList() // The bulk of your code, after the realize, goes into this function.
}
} // end clbkSyncObj()
//***********************
void DeploySyncTrigger()
{
g_trgSync = trigger(object, sync, 8, clbkSyncObj)
} // end DeploySyncTrigger()
//**********************
void applyClose(DB dbXX)
{ // Close the Dialog
hide(objAttr)
destroy(objAttr)
RemoveSyncTrigger()
} // end applyClose()
objAttr = create("Object Attributes - "name(mTitle)"", styleCentered|styleFixed)
lstAttr = listView(objAttr, 0, 500, 20, arrLst)
close(objAttr, true, applyClose) // Define custom Close for this dialog
DeploySyncTrigger()
realize(objAttr)
insertColumn(lstAttr, 0, "Attributes", 175, iconNone)
insertColumn(lstAttr, 1, "Values", 300, iconNone)
getAttrList()
show(objAttr)
|